﻿Partial Public Class RegistrarCAL
    Inherits System.Web.UI.Page
    Dim ocnTrabajoFinal As New CapaNegocio.TrabajoFinal()
    Dim ocnNotas As New CapaNegocio.Notas


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        cargargrilla(Me.TextBoxNroExpediente.Text)
    End Sub

    Function cargargrilla(ByVal nroExpediente As String)
        Dim ds As New DataSet

        ds = ocnNotas.obtenerNotasProfesores(nroExpediente)

        Me.GridViewProfesoresCAL.DataSource = ds.Tables(0)

        Me.GridViewProfesoresCAL.DataBind()
        Return Me.GridViewProfesoresCAL
    End Function

    Protected Sub ButtonAgregarProfesor_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonAgregarProfesor.Click
        Try
            ocnNotas.InsertarNotaProfesor(Me.TextBoxNroExpediente.Text, Me.TextBoxDniProfesor.Text)
            cargargrilla(Me.TextBoxNroExpediente.Text)
        Catch ex As Exception
            Session.Add("exError", ex)
            Response.Redirect("ManejarError.aspx")
        End Try
    End Sub

    Protected Sub ButtonRegistrarCAL_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonRegistrarCAL.Click
        Try
            ocnNotas.InsertarNroResolucionCAL(Me.TextBoxNroResolucionCAL.Text, Me.TextBoxNroExpediente.Text _
                                                     , CDate(Me.TextBoxFecha.Text))

            cargargrilla(Me.TextBoxNroExpediente.Text)
        Catch ex As Exception
            Session.Add("exError", ex)
            Response.Redirect("ManejarError.aspx")
        End Try
    End Sub

    Protected Sub ButtonMostrarCAL_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonMostrarCAL.Click
        Try
            cargargrilla(Me.TextBoxNroExpediente.Text)
        Catch ex As Exception
            Session.Add("exError", ex)
            Response.Redirect("ManejarError.aspx")
        End Try
    End Sub
End Class